float4x4 xProjection;
float4x4 xView;
float4x4 xWorld;

Texture xTexture;

sampler TextureSampler = sampler_state { texture = <xTexture>; magfilter = LINEAR; minfilter = LINEAR; mipfilter = LINEAR;
    AddressU = CLAMP; AddressV = CLAMP; };

struct TexturedToPixel
{
    float4 Position : POSITION;
    float2 TexCoord : TEXCOORD0;
};

struct TexturedToScreen
{
    float4 Color : COLOR;
};

TexturedToPixel TexturedVertexShader(float4 inPos : POSITION, float2 inTexCoord : TEXCOORD0)
{
    TexturedToPixel output = (TexturedToPixel)0;

    float4x4 preViewProjection = mul(xView, xProjection);
    float4x4 preWorldViewProjection = mul(xWorld, preViewProjection);

    output.Position = mul(inPos, preWorldViewProjection);
    output.TexCoord = inTexCoord;

    return output;
}

TexturedToScreen TexturedPixelShader(TexturedToPixel inPS)
{
    TexturedToScreen output = (TexturedToScreen)0;

    output.Color = tex2D(TextureSampler, inPS.TexCoord);

    return output;
}

technique Textured
{
    pass Pass0
    {
        VertexShader = compile vs_2_0 TexturedVertexShader();
        PixelShader = compile ps_2_0 TexturedPixelShader();
    }
}